import React, { Component } from 'react'
import { Context } from './context'

// !#3 使用 Context.Consumer 配合函数使用数据
export default class B extends Component {
  render() {
    return (
      <Context.Consumer>
        {(value) => (
          <div>
            <p>B: {value.count}</p>
            <button onClick={() => value.changeCount(3)}>改</button>
          </div>
        )}
      </Context.Consumer>
    )
  }
}
